package com.fc.entities

import javax.persistence.Column
import javax.persistence.Entity
import javax.persistence.Table
import javax.validation.constraints.NotNull
import javax.validation.constraints.Size

/**
 * 
 * @author aacs
 *
 */
@Entity
@Table(name = "FoodGroup")
class FoodGroup extends BaseEntity{
	
	@Column(name = "name", unique = true)
	@NotNull
	@Size(max=30)
	String name
	
	@Override
	public String toString() {
		return name;
	}
	
	@Override
	public boolean equals(Object obj) {
		if (obj == null || !(obj instanceof FoodGroup)) {
			return false;	
		}
		FoodGroup other = (FoodGroup)obj;
		if (other.id == id && other.name == name) {
			return true;
		}
		return false;
	}
}
